package gae.google.tcserver.db;

import java.io.Serializable;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

/**
 * The <tt>Team</tt> class defines the database table that
 * holds information about this entity 
 *
 * @author Lars Friberg
 *
 * @date 2011-01-13
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class Team implements Serializable {

	
	/**
	 * Serial version Id
	 */
	private static final long serialVersionUID = 1L;

	@PrimaryKey
	@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
	private Key keyId;				 	 // this is the primary key Id
	
	@Persistent
	private String name;				 // this is the name of the team

	@Persistent
	private String calendar;			 // this is the team calendar
	
	@Persistent
	private String image;				 // this is the image of the team

	@Persistent
	private Key userKeyId;				 // this is the user key Id
	
	@Persistent
	private List<Key> memberKeyIds;	 	 // team member Id's 
	
	/**
	 * get primary key Id
	 * 
	 * @return keyId the primary key id
	 */
	public Key getKeyId() {
		return keyId;
	}

	/**
	 * get name
	 * 
	 * @return name the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * get calendar
	 * 
	 * @return calendar the calendar
	 */
	public String getCalendar() {
		return calendar;
	}

	/**
	 * get image
	 * 
	 * @return image the image
	 */
	public String getImage() {
		return image;
	}

	/**
	 * get user key Id
	 * 
	 * @return userKeyId the user key Id 
	 */
	public Key getUserKeyId() {
		return userKeyId;
	}

	/**
	 * get member key Id's
	 * 
	 * @return memberKeyIds the member key Id's 
	 */
	public List<Key> getMemberKeyIds() {
		return memberKeyIds;
	}
	
	/**
	 * set team member key Id's
	 *
	 * @param memberKeyIds the list of member key Id's to set
	 */
	public void setMemberKeyIds(List<Key> memberKeyIds) {
		this.memberKeyIds = memberKeyIds;
	}
	
	/**
	 * Constructor
	 */
	public Team() {
		super();
	}

	/**
	 * constructor, initiate parameters
	 * 
	 * @param name the name
	 * @param calendar the calendar
	 * @param image the image
	 */
	public Team(String name, String calendar, String image, Key userKeyId) {
		super();
		this.name = name;
		this.calendar = calendar;
		this.image = image;
		this.userKeyId = userKeyId;
	}
}